<template>
  <div class="app-container">
    <el-card shadow="never">
      <div slot="header">
        <span>列表信息</span>
      </div>
      <el-table ref="usageTable" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
        <template slot="empty">
          <el-empty image-size="110" />
        </template>
        <el-table-column type="expand">
          <template slot-scope="{row}">
            <el-form label-position="left" inline class="table-expand">
              <el-form-item label="企业需求：">
                <span>{{ row.enterpriseDemand_dictText }}</span>
              </el-form-item>
              <el-form-item label="备注：">
                <span>{{ row.remark || '无' }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="主管理员" align="left" prop="admin" />
        <el-table-column label="是否使用钉钉" align="center" prop="isUseDd_dictText" />
        <el-table-column label="使用人数" align="center" prop="usersNum" />
        <el-table-column label="私海情况" align="center" prop="shSituation_dictText" />
        <el-table-column label="认证情况" align="center" prop="certification_dictText" />
        <el-table-column label="成熟度" align="center" prop="maturity_dictText" />
        <el-table-column label="钉钉指数" align="center" prop="ddIndex">
          <template slot-scope="{row}">
            <span>{{ row.ddIndex || '无' }} </span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="{row}">
            <el-button size="small" type="text" @click="handleEdit(row)">编辑</el-button>
            <el-divider direction="vertical" />
            <el-popconfirm confirm-button-text="确定" cancel-button-text="取消" icon="el-icon-info" icon-color="red" title="确认删除该条信息吗?" @confirm="handleDelete(row)">
              <el-button slot="reference" size="small" type="text">删除</el-button>
            </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>
      <el-button plain icon="el-icon-plus" class="mt16" style="width:100%" type="small" @click="handleAdd">新增</el-button>
    </el-card>

    <usage-drawer ref="usage" :show.sync="usage.open" @close="getList" />
  </div>
</template>

<script>
import UsageDrawer from '../modules/usageDrawer'
export default {
  name: 'UsageTable',
  components: { UsageDrawer },
  data() {
    return {
      tableData: [
        {
          isUseDd_dictText: '是',
          shSituation_dictText: '在中台',
          certification_dictText: '在线上',
          maturity_dictText: '联系到KP',
          certification: '21',
          maturity: '11',
          isUseDd: '0',
          admin: '徐茂辉',
          updateTime: null,
          remark: null,
          createBy: '13583897221',
          usersNum: '28',
          customerId: '1389877792455249921',
          sysOrgCode: 'A01A31',
          shSituation: '1',
          ddIndex: '65',
          id: '1390140087345336321',
          enterpriseDemand_dictText:
            '人员管理,假勤管理,行政管理,文档管理,视频会议,流程管理'
        },
        {
          isUseDd_dictText: '是',
          shSituation_dictText: '在中台',
          certification_dictText: '在线上',
          maturity_dictText: '已完成免费部署',
          certification: '21',
          maturity: '1',
          isUseDd: '0',
          admin: '崔皓栋',
          remark: '崔皓栋测试备注',
          usersNum: '14',
          customerId: '1389877792455249921',
          sysOrgCode: 'A01A31',
          ddIndex: '83',
          shSituation: '21',
          id: '1390140087345336321',
          enterpriseDemand_dictText: '行政管理,文档管理,视频会议,流程管理'
        },
        {
          isUseDd_dictText: '否',
          shSituation_dictText: '在中台',
          certification_dictText: '在线上',
          maturity_dictText: '已完成免费部署',
          certification: '21',
          maturity: '1',
          admin: '李宝伟',
          remark: null,
          isUseDd: '1',
          usersNum: '16',
          customerId: '1389877792455249921',
          sysOrgCode: 'A01A31',
          ddIndex: '95',
          shSituation: '11',
          id: '1390140087345336321',
          enterpriseDemand_dictText: '人员管理,假勤管理,行政管理,流程管理'
        }
      ],
      usage: {
        open: false
      }
    }
  },
  created() {},
  methods: {
    getList() {},
    handleAdd() {
      this.usage.open = true
      this.$refs.usage.add()
    },
    handleEdit(row) {
      this.usage.open = true
      this.$refs.usage.edit(row)
    },
    handleDelete(row) {},
    handleSelectionChange() {}
  }
}
</script>

<style>
.table-expand {
  font-size: 0;
}
.table-expand label {
  width: 90px;
  color: #99a9bf;
}
.table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>

<style lang='scss' scoped>
@import '~@/assets/styles/details.scss';

::v-deep .el-table__expanded-cell {
  padding: 20px 60px;
}
</style>
